package com.moxie.ocr.ocr.idcard;

import android.os.Parcel;

import com.moxie.ocr.ocr.base.Card;

public class MXOCRResult extends Card {

    // 裁剪后的身份证图片
    private byte[] cropImage;
    // 扫描时的原图片
    private byte[] cameraApertureImage;
    // 人脸头像图片
    private byte[] cropFaceImage;

    private static com.linkface.ocr.card.Card.Side side;

    public MXOCRResult(byte[] cardResult,Side side) {
        switch (side){
            case BACK:
                this.side= com.linkface.ocr.card.Card.Side.BACK;
            case FRONT:
                this.side= com.linkface.ocr.card.Card.Side.FRONT;
        }
    }

    public MXOCRResult(){
    }

    public MXOCRResult(byte[] cardResult, com.linkface.ocr.card.Card.Side side) {
        this.side = side;
    }


    public static final Creator<MXOCRResult> CREATOR = new Creator<MXOCRResult>() {
        public MXOCRResult createFromParcel(Parcel source) {
            return new MXOCRResult(source);
        }

        public MXOCRResult[] newArray(int size) {
            return new MXOCRResult[size];
        }
    };

    private MXOCRResult(Parcel src) {
        this.side = (com.linkface.ocr.card.Card.Side)src.readSerializable();
        this.cropImage = src.createByteArray();
        this.cameraApertureImage = src.createByteArray();
        this.cropFaceImage = src.createByteArray();
    }

    public void writeToParcel(Parcel dest, int flags) {
        dest.writeSerializable(side);
        dest.writeByteArray(cropImage);
        dest.writeByteArray(cameraApertureImage);
        dest.writeByteArray(cropFaceImage);
    }


    public Side getSide() {
        switch (side){
            case BACK:
                return Side.BACK;
            case FRONT:
                return Side.FRONT;
            default:
                return null;
        }

    }

    public byte[] getCropImage() {
        return cropImage;
    }

    public void setCropImage(byte[] cropImage) {
        this.cropImage = cropImage;
    }

    public byte[] getCameraApertureImage() {
        return cameraApertureImage;
    }

    public void setCameraApertureImage(byte[] cameraApertureImage) {
        this.cameraApertureImage = cameraApertureImage;
    }

    public byte[] getCropFaceImage() {
        return cropFaceImage;
    }

    public void setCropFaceImage(byte[] cropFaceImage) {
        this.cropFaceImage = cropFaceImage;
    }
}
